﻿<KCtl:BasePhoneApplicationPage x:Class="Kiva7.SettingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                               xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Settings="clr-namespace:Kiva7.Settings"
    xmlns:KCtl="clr-namespace:Kiva7.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                               xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                               FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" 
    d:DesignWidth="480"
    shell:SystemTray.IsVisible="True" 
    BackKeyPress="PhoneApplicationPageBackKeyPress" 
    Loaded="PhoneApplicationPageLoaded">

    <KCtl:BasePhoneApplicationPage.Resources>
        <Settings:AppSettings x:Key="appSettings"></Settings:AppSettings>
    </KCtl:BasePhoneApplicationPage.Resources>

    <KCtl:OrientedPivot Title="Kiva">

        <controls:PivotItem Header="{Binding Path=L.Settings, Source={StaticResource L}}">


            <!--ContentPanel - place additional content here-->
            <StackPanel x:Name="ContentPanel" Grid.Row="1" >
                <TextBlock Text="{Binding Path=L.LenderID, Source={StaticResource L}}" Style="{StaticResource KivaTextAccentStyle}"/>

                <TextBox Text="{Binding Source={StaticResource appSettings}, Path=LenderIdSetting, Mode=TwoWay}"  />

                <TextBlock Text="{Binding Path=L.UserId, Source={StaticResource L}}" Style="{StaticResource KivaTextAccentStyle}"/>
                <TextBox Text="{Binding Source={StaticResource appSettings}, Path=UserIdSetting, Mode=TwoWay}">
                    <TextBox.InputScope>
                        <InputScope  >
                            <InputScopeName NameValue="EmailSmtpAddress" />
                        </InputScope>
                    </TextBox.InputScope>
                </TextBox>
                <TextBlock Text="{Binding Path=L.Password, Source={StaticResource L}}" Style="{StaticResource KivaTextAccentStyle}"/>
                <PasswordBox Password="{Binding Source={StaticResource appSettings}, Path=PasswordSetting, Mode=TwoWay}"  />


                <Button  Click="GetLenderIdClick" Style="{StaticResource KivaButtonStyle}">
                    <TextBlock Text="{Binding Path=L.ClickGetLenderID, Source={StaticResource L}}" 
                           TextWrapping="Wrap"/>
                </Button>

                <toolkit:ListPicker x:Name="lpTranslateTexts" 
                                Header="{Binding Path=L.TranslateTexts, Source={StaticResource L}}" 
                                SelectionChanged="LpTranslateTextsSelectionChanged" >

                    <toolkit:ListPicker.FullModeItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="16 21 0 20">
                                <Rectangle Fill="{Binding}" Width="43" Height="43"/>
                                <TextBlock Text="{Binding}" Margin="16 0 0 0" FontSize="43" 
                                   FontFamily="{StaticResource PhoneFontFamilyLight}"/>
                            </StackPanel>
                        </DataTemplate>
                    </toolkit:ListPicker.FullModeItemTemplate>

                </toolkit:ListPicker>

                <toolkit:ToggleSwitch x:Name="tswShowBackgroundImage"
                                  Header="{Binding Path=L.BackgroundImage, Source={StaticResource L}}" 
                                  IsChecked="{Binding Source={StaticResource appSettings}, Path=ShowBackgroundImage, Mode=TwoWay}"    
                                  Checked="ToggleSwitch_Checked"     
                                  Unchecked="ToggleSwitch_Unchecked" />

            </StackPanel>
        </controls:PivotItem>
    </KCtl:OrientedPivot>

</KCtl:BasePhoneApplicationPage>
